home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 May: Tool Chest / Developer CD Series Tool Chest (Apple Computer)(May 1999).iso / Tool Chest / Networking / SNMP / SNMP Development / MacSNMP Developer 1.0.2 / Tools / MakeExpFile < prev    next >
Encoding:
Text File  |  1993-06-15  |  6.3 KB  |  268 lines  |  [TEXT/MPS ]

  1. #
  2. #    File:        MakeExpFile
  3. #
  4. #    Contains:    xxx put contents here xxx
  5. #
  6. #    Copyright:    © 1992 by Apple Computer, Inc., all rights reserved.
  7. #
  8. #
  9.  
  10. If {#} < 2 || `Exists "{1}"`
  11.     Echo "Usage: MakeExpFile outputFile Infile Infile..."
  12.     Echo "       The output file must not already exist!"
  13.     Exit 10
  14. End
  15. Set OutFile "{1}"
  16. Set OutName "{1}"
  17. If "{OutName}" =~ /≈∂:([¬∂:]+)®1/
  18.     Set OutName "{®1}"
  19. End
  20. Shift
  21. Echo "/*" >"{OutFile}"
  22. Echo "    File:        {OutName}" >>"{OutFile}"
  23. Echo "*/" >>"{OutFile}"
  24. Echo "" >>"{OutFile}"
  25. Set Files "{Parameters}"
  26. Set IncList    ","
  27. For Name in {Files}
  28.     Set InFile "{Name}"
  29.     ModifyReadOnly "{InFile}" ∑∑ Dev:Null || Set Status 0
  30.     Target "{InFile}"
  31.     Find • "{InFile}"
  32.     LOOP
  33.         Find /•[ ∂t]*∂#include[ ∂t]+≈∞/ "{InFile}" || Break
  34.         Set Temp "``catenate "{InFile}".§``"
  35.         If "{{Temp}}" =~ /[ ∂t]*∂#include[ ∂t]+(∂<≈∂>)®1≈/
  36.             If "{{IncList}}" !~ /≈,{{®1}},≈/
  37.                 Set IncList "{{IncList}}{{®1}},"
  38.                 Echo "{{Temp}}" >>"{OutFile}"
  39.             End
  40.         Else If "{{IncList}}" !~ /≈,{{®1}},≈/
  41.             If "{{®1}}" !~ /≈,{{IncList}},≈/
  42.                 Set IncList "{{IncList}}{{®1}},"
  43.                 Echo "{{Temp}}" >>"{OutFile}"
  44.             End
  45.         Else
  46.             Echo "{{Temp}}" >>"{OutFile}"
  47.         End
  48.     End
  49.     Find • "{InFile}"
  50. End
  51. Echo "" >>"{OutFile}"
  52. Set FndLib     0
  53. For InFile in {Files}
  54.     Target "{InFile}"
  55.     Find • "{InFile}"
  56.     LOOP
  57.         Find /•[ ∂t]*∂#pragma[ ∂t]+library[ ∂t]≈∂n/ "{InFile}" || Break
  58.         Set Temp "``catenate "{InFile}".§``"
  59.         Set Version ""
  60.         Set ID ""
  61.         Set Flags ""
  62.         If "{{Temp}}" =~ /≈[ ∂t]+id[ ∂t]*=[ ∂t]*([¬ ∂t,]+)®1[ ∂t]*,≈/
  63.             Set ID "{{®1}}"
  64.         Else
  65.             Echo "Poorly formed #pragma library in file {InFile}"
  66.             Echo "--->{{Temp}}"
  67.             Exit 10
  68.         End
  69.         If "{{Temp}}" =~ /≈[ ∂t]+version[ ∂t]*=[ ∂t]*([¬,]+)®1≈/
  70.             Set Version "{®1}"
  71.         Else
  72.             Echo "Poorly formed #pragma library in file {InFile}"
  73.             Echo "--->{{Temp}}"
  74.             Exit 10
  75.         End
  76.         If "{{Temp}}" =~ /≈[ ∂t]+flags[ ∂t]*=(≈)®1/
  77.             Set Flags "{®1}"
  78.             If "{Flags}" =~ /(≈)®1useclientpool(≈)®2/
  79.                 Set Flags "memory=client"
  80.             else
  81.                 Set Flags ""
  82.             End
  83.         End
  84.         Set FndLib 1
  85.         Break
  86.     End
  87.     If {FndLib}
  88.         Clear § "{InFile}"
  89.         Find §:§!1 "{InFile}"
  90.         If "``catenate "{InFile}.§"``" == ""
  91.             Clear § "{Infile}"
  92.         End
  93.         Break
  94.     End
  95. End
  96. If {FndLib}
  97.     Echo "Library" >>"{OutFile}"
  98.     Echo "∂{" >> "{OutFile}"
  99.     Echo "∂tid = {{ID}};" >> "{Outfile}"
  100.     Echo "∂tversion = {Version};" >> "{OutFile}"
  101.     If "{Flags}" != ""
  102.         Echo "∂t{Flags};" >> "{OutFile}"
  103.     End
  104.     Echo "∂};" >>"{OutFile}"
  105.     Echo "" >>"{OutFile}"
  106. Else
  107.     Echo "WARNING: No #pragma library was found in these files"
  108. End
  109.  
  110. For InFile in {Files}
  111.     Target "{InFile}"
  112.     LOOP
  113.         Find • "{InFile}"
  114.         Find /•[ ∂t]*∂#pragma[ ∂t]+class[ ∂t]+≈∂n/ "{InFile}" || Break
  115.         Set Temp "``catenate "{InFile}".§``"
  116.         Set Class ""
  117.         Set Parent ""
  118.         Set ID ""
  119.         Set Flags ""
  120.         If "{{Temp}}" =~ /≈[ ∂t]+name[ ∂t]*=[ ∂t]*([¬ ∂t,]+)®1[ ∂t]*,≈/
  121.             Set Class "{®1}"
  122.         Else
  123.             Echo "Poorly formed #pragma class in file {InFile}"
  124.             Echo "--->{{Temp}}"
  125.             Exit 10
  126.         End
  127.         If "{{Temp}}" =~ /≈[ ∂t]+id[ ∂t]*=[ ∂t]*([¬,]+)®1≈/
  128.             Set ID "{{®1}}"
  129.         Else
  130.             Echo "Poorly formed #pragma class in file {InFile}"
  131.             Echo "--->{{Temp}}"
  132.             Exit 10
  133.         End
  134.         If "{{Temp}}" =~ /≈[ ∂t]+parent[ ∂t]*=[ ∂t]*([¬,]+)®1≈/
  135.             Set Parent "{{®1}}"
  136.         End
  137.         If "{{Temp}}" =~ /≈[ ∂t]+flags[ ∂t]*=(≈)®1/
  138.             Set Flags "{®1}"
  139.         End
  140.         Clear § "{InFile}"
  141.         Find §:§!1 "{InFile}"
  142.         If "``catenate "{InFile}.§"``" == ""
  143.             Clear § "{Infile}"
  144.         End
  145.         If "{{Parent}}" =~ /k(≈)®1ID/
  146.             Echo "Class {Class} : {®1}" >> "{OutFile}"
  147.             Set pID 1
  148.         Else
  149.             Echo "Class {Class}" >> "{OutFile}"
  150.             Set pID 0
  151.         End
  152.         Echo "∂{" >> "{OutFile}"
  153.         Echo "∂tid = {{ID}};" >> "{OutFile}"
  154.         If {pID}
  155.             Echo "∂t{®1} = {{Parent}};" >> "{OutFile}"
  156.         End
  157.         if "{Flags}" =~ /≈newobject≈/ || "{Flags}" =~ /≈preload≈/
  158.             Echo -n "∂tflags = " >> "{OutFile}"
  159.             If "{Flags}" =~ /≈preload≈/ && "{Flags}" =~ /≈newobject≈/
  160.                 Echo "newobject, preload;" >> "{OutFile}"
  161.             Else If "{Flags}" =~ /≈preload≈/
  162.                 Echo "preload;" >> "{OutFile}"
  163.             Else
  164.                 Echo "newobject;" >> "{OutFile}"
  165.             End
  166.         End
  167.         Echo "∂};" >> "{OutFile}"
  168.         Echo "" >>"{OutFile}"
  169.     End
  170. End
  171. Echo "" >>"{OutFile}"
  172. For InFile in {Files}
  173.     Find • "{Infile}"
  174.     LOOP
  175.         Find /•[ ∂t]*FunctionSet[ ∂t]*∂((≈)®1∂)≈∂n/ "{InFile}" || Break;
  176.         Set Temp "``catenate "{InFile}".§``"
  177.         Clear § "{InFile}"
  178.         Find !0 "{InFile}"
  179.         If "{{Temp}}" =~ /[ ∂t]*FunctionSet[ ∂t]*∂((≈)®1∂)≈/
  180.             Echo "FunctionSet {®1}" >> "{OutFile}"
  181.         End
  182.         Echo "∂{" >> "{OutFile}"
  183.         LOOP
  184.             Set Temp "``catenate "{InFile}".§``"
  185.             If "{{Temp}}" =~ /[ ∂t]*∂{«0,1»[ ∂t]*FunctionSetID[ ∂t]*∂(≈∂)≈/
  186.                 Break;
  187.             Else
  188.                 Clear § "{InFile}"
  189.                 Find !0 "{InFile}"
  190.             End
  191.         End
  192.         If "{{Temp}}" =~ /[ ∂t]*∂{«0,1»[ ∂t]*FunctionSetID[ ∂t]*∂((≈)®1∂)≈/
  193.             Mark -y § TempSel "{InFile}"
  194.             Find • "{InFile}"
  195.             Set Temp 0
  196.             Find /•[ ∂t]*#define[ ∂t]*{{®1}}[ ∂t]*(≈)®2/ || Set Temp 1
  197.             If {Temp} == 0
  198.                 Set Temp "``catenate "{InFile}".§``"
  199.                 If "{{Temp}}" =~ /[ ∂t]*#define[ ∂t]*{{®1}}[ ∂t]*(≈)®2/
  200.                     Clear § "{InFile}"
  201.                     Find !0 "{InFile}"
  202.                     If "``catenate "{InFile}".§``" == ""
  203.                         Clear § "{InFile}"
  204.                         Find !0 "{InFile}"
  205.                     End
  206.                     Echo "∂tid = {{®2}};" >> "{OutFile}"
  207.                 End
  208.             Else
  209.                 Echo "∂tid = {{®1}};" >> "{OutFile}"
  210.             End
  211.             Find TempSel "{InFile}"
  212.             UnMark TempSel "{InFile}"
  213.         End
  214.         Set First 1
  215.         LOOP
  216.             Clear § "{InFile}"
  217.             Find !0 "{InFile}"
  218.             Set Temp "``catenate "{InFile}".§``"
  219.             If "{{Temp}}" =~ /[ ∂t]*Export≈/
  220.                 If "{{Temp}}" =~ /[ ∂t]*ExportFunction[ ∂t]*∂(([¬,]+)®3∂,[ ∂t]*([¬,]+)®1≈/
  221.                     If "{{®3}}" =~ /≈pascal≈/
  222.                         Set type "pascal "
  223.                     Else
  224.                         Set type ""
  225.                     End
  226.                     If {First}
  227.                         Echo -n "∂texports = {type}{®1}" >>"{OutFile}"
  228.                         Set First 0
  229.                     Else
  230.                         Echo "," >>"{OutFile}"
  231.                         Echo -n "∂t∂t∂t  {type}{®1}" >>"{OutFile}"
  232.                     End
  233.                 Else If "{{Temp}}" =~ /[ ∂t]*ExportMemberFunction[ ∂t]*∂(([¬,]+)®4∂,[ ∂t]*([¬,]+)®1,[ ∂t]*([¬,]+)®2≈/
  234.                     If "{{®4}}" =~ /≈pascal≈/
  235.                         Set type "pascal "
  236.                     Else
  237.                         Set type ""
  238.                     End
  239.                     If {First}
  240.                         Echo -n "∂texports = {type}{®1}::{{@2}}" >>"{OutFile}"
  241.                         Set First 0
  242.                     Else
  243.                         Echo "," >>"{OutFile}"
  244.                         Echo -n "∂t∂t∂t  {type}{®1}::{®2}" >>"{OutFile}"
  245.                     End
  246.                 Else
  247.                     Echo "Poorly formed Export line in file {InFile}"
  248.                     Echo "--->{{Temp}}"
  249.                     Exit 10
  250.                 End
  251.             End
  252.             If "{{Temp}}" =~ /≈∂}≈/
  253.                 Clear § "{InFile}"
  254.                 Find !0 "{InFile}"
  255.                 If "``catenate "{InFile}".§``" == ""
  256.                     Clear § "{InFile}"
  257.                     Find !0 "{InFile}"
  258.                 End
  259.                 Break
  260.             End
  261.         End
  262.         Echo ";" >>"{OutFile}"
  263.         Echo "};" >>"{OutFile}"
  264.         Echo "" >>"{OutFile}"
  265.     End
  266. End
  267. Echo "" >> "{OutFile}"
  268.